package file;

import java.io.File;

public class FileDemo {
    public static void main(String[] args) {
        File file =new File("./demo.txt");

        String name =file.getName();
        System.out.println(name);

        long len =file.length();//file的长度只能用long接收
        //文件不存在或文件没内容即为0
        System.out.println(len);

        boolean ih =file.isHidden();
        boolean cr = file.canRead();
        boolean cw =file.canWrite();
        System.out.println("隐藏"+ih);
        System.out.println("可读"+cr);
        System.out.println("可写"+cw);
    }
}
